const propertiesForm = [
    {
        model: 'ui.labelPosition',
        widget: 'radioButton',
        label: '标题位置',
        enum: [
            { label: 'left', value: '左对齐' },
            { label: 'right', value: '右对齐' },
            { label: 'top', value: '顶部对齐' }
        ],
        ui: {
            placeholder: '标题位置'
        }
    },
    {
        model: 'ui.labelWidth',
        widget: 'input',
        label: '标题宽度',
        ui: {
            placeholder: '请携带单位(如: 100px)',
            maxlength: 20
        }
    },
    {
        model: 'ui.size',
        widget: 'radioButton',
        label: '大小(优先级低于‘字段属性’里的大小)',
        enum: [
            { value: '默认', label: 'default' },
            { value: '小', label: 'mini' },
            { value: '中', label: 'small' },
            { value: '大', label: 'medium' }
        ],
        ui: {
            clearable: true,
            style: {
                placeholder: '请选择大小',
                width: '100%'
            }
        }
    },
    {
        model: 'ui.labelSuffix',
        widget: 'input',
        label: '标题后缀',
        ui: {
            placeholder: '请输入标题后缀',
            maxlength: 20
        }
    },
    {
        model: 'ui.hideRequiredAsterisk',
        widget: 'switch',
        label: '隐藏红色星号'
    },
    {
        model: 'ui.showMessage',
        widget: 'switch',
        label: '显示校验提示信息'
    },
    {
        model: 'ui.showMessage',
        widget: 'switch',
        label: '以行内形式显示校验提示信息',
        if (model) {
            return model && model.ui && model.ui.showMessage
        }
    },
    {
        model: 'ui.statusIcon',
        widget: 'switch',
        label: '在输入框中显示校验结果反馈图标'
    },
    {
        model: 'ui.disabled',
        widget: 'switch',
        label: '禁用整个表单'
    }
]

export const schemaEditSchema = {
    properties: [
        {
            model: '_form',
            widget: 'custom',
            label: ''
        },
        ...propertiesForm.map(e => {
            return {
                ...e,
                _mode: 'form',
                hidden: false
            }
        }),
        {
            model: '_enum',
            widget: 'custom',
            label: ''
        },
        {
            _mode: 'enum',
            hidden: false,
            model: 'enum',
            widget: 'custom',
            label: ''
        }
    ],
    ui: {
        labelPosition: 'top'
    }
}
